Indexed Freeモナド
データ型
code:hs
data IxFree f i j x where
Pure a :: a -> IxFree i i a
Join :: f i j (IxFree f j k a) -> IxFree f i k a
定義
code:hs
instance IxFunctor f => IxMonad (IxFree f) where
ireturn = Pure
ibind k (Pure a) = k a
ibind k (Free f) = Free $ imap (ibind k) f